package code1;

public class Code {

    public static void main(String[] args) {

        String str = "ABCD123!@#$%ab";

        int x1=0, x2=0, x3=0, x4=0;
        for(int i=0; i<str.length(); i++){
            if(str.charAt(i)>='A' && str.charAt(i)<='Z'){
                x1++;
            }else if(str.charAt(i)>='a' && str.charAt(i)<='z'){
                x2++;
            }else if(str.charAt(i)>='0' && str.charAt(i)<='9'){
                x3++;
            }else{
                x4++;
            }
        }
        System.out.println("大写字母个数：" + x1);
        System.out.println("小写字母个数：" + x2);
        System.out.println("数字个数：" + x3);
        System.out.println("其他字符个数：" + x4);
    }
}
